package com.codeiy.criteria;

/**
 * 查询条件断言
 * @author Bruce
 */
public enum Predicate {
    /**
     * 判断条件
     */
    EQ("="),
    NE("<>"),
    NULL("IS NULL"),
    NOT_NULL("IS NOT NULL"),
    GT(">"),
    GE(">="),
    LT("<"),
    LE("<="),
    LIKE("LIKE"),
    NOT_LIKE("NOT LIKE"),
    IN("IN"),
    NOT_IN("NOT IN");

    private String rendered;

    Predicate(String rendered) {
        this.rendered = rendered;
    }

    public String getRendered() {
        return rendered;
    }

    public static Predicate statOf(String rendered) {
        for (Predicate predicate : values()){
            if (predicate.getRendered().equals(rendered)) {
                return predicate;
            }
        }
        return null;
    }
}
